package com.wavehi.process_of_load;

/**
 * @Author WaveHi
 * @Date 1/10/2021 下午 6:32
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Method '<clinit>' is locked synchronously.
 */
public class CInitDemo02 {
    public static void main(String[] args) {
        Runnable r = () -> {
            System.out.println("Class loading start!");
            ForTestClass forTestClass = new ForTestClass();
            System.out.println("Class loading completed!");
        };
        Thread t1 = new Thread(r);
        Thread t2 = new Thread(r);
        t1.start();
        t2.start();
    }
}

class ForTestClass {
    static {
        if(true) {
            System.out.println("I am being loaded!");
            while(true) {

            }
        }
    }
}
